#include<cnedvalue.h>
#include<cnedfunction.h>
#include<distrib.h>

static cNEDValue onoff(cComponent *context, cNEDValue argv[], int argc){
    double p = (double)argv[0];
    double lambda = (double)argv[1];
    long x=0;
    double randomNumber = uniform(0,1);
    if(randomNumber < p) {
        x = poisson(lambda);
    }
    else x = poisson(lambda)*10;

        return (long)x;
};

EXECUTE_ON_STARTUP(nedFunctions.getInstance()->add(new cNEDFunction(onoff,"int onoff(double p, double lambda)"));)
